<admintpl file="header" />
<script type='text/javascript' src="__PUBLIC__/ckeditor/ckeditor.js"></script>
<script type='text/javascript' src="__PUBLIC__/js/hanzitopinyin.js"></script>
</head>
<body>
	<div class="wrap js-check-wrap">
		<ul class="nav nav-tabs">
			<li><a href="{:U('Shop/index')}" target="_self">{:L('SHOP_SHOP_NAME')}</a></li>
			<li class="active"><a href="#A" data-toggle="tab">{:L('SHOP_SHOP_ADD')}</a></li>
		</ul>
		<form class="form-horizontal js-ajax-form" enctype="multipart/form-data" action="{:U('Shop/add_post')}" method="post">
			<div class="tabbable">
				<div class="tab-content">
					<div class="tab-pane active" id="A">
						<fieldset>
							<div class="control-group">
								<label class="control-label">{:L('SHOP_NAME')}</label>
								<div class="controls">
									<input type="text" name="shopName" value=""><span
										class="form-required">*</span>
								</div>
							</div>
							<div class="control-group">
								<label class="control-label">{:L('SHOP_NUMBER')}</label>
								<div class="controls">
									<input type="text" name="number" value=""><span
										class="form-required">*</span>
								</div>
							</div>
							
							<div class="control-group">
								<label class="control-label">{:L('SHOP_SHOP_ADDRESS')}</label>
								<div class="controls">
									<input type='text' name='address' value=""/>
								</div>
							</div>
							
							<div class="control-group">
								<label class="control-label">{:L('SHOP_FLOOR_NAME')}</label>
								<div class="controls">
									<Volist name='floors' id='vo'> <label
										class='radio inline '><input type='radio'
										name='floorID' value='{$vo.id}'>{$vo.name}</label> </Volist>
								</div>
							</div>
							<div class="control-group">
								<label class="control-label">{:L('SHOP_FORMAT_NAME')}</label>
								<div class="controls">
									<Volist name='formats' id='vo'> <label
										class='checkbox inline '><input type='checkbox'
										name='formatID[]' value='{$vo.id}'>{$vo.name}</label> </Volist>
								</div>
							</div>
							
							<div class="control-group">
								<label class="control-label">商铺首拼</label>
								<div class="controls" >
									<input type='text' name='sp' value=""/>
									<input type='button' class="onkeymake" value='一键生成'/>
								</div>
								
							</div>
							
							<div class="control-group">
								<label class="control-label">商铺全拼</label>
								<div class="controls">
									<input type='text' name='qp' value=""/>
								</div>
							</div>
							
							<div class="control-group">
								<label class="control-label">商铺简拼</label>
								<div class="controls">
									<input type='text' name='jp' value=""/>
								</div>
							</div>
							
							<div class="control-group">
								<label class="control-label">{:L('SHOP_SHOP_ATTAC')}</label>
								<div class="controls">
									<input  type='file' name='attac' value=''/>
								</div>
							</div>
							
							
							<div class="control-group">
								<label class="control-label">{:L('SHOP_SHOP_CONTENT')}</label>
								<div class="controls">
									<textarea name='content' id='content'  class="ckeditor" ></textarea>
									<script type="text/javascript">
								   	 CKEDITOR.replace('content',{toolbar:'mybar'});
								</script>
								</div>
							</div>
						</fieldset>
					</div>
				</div>
			</div>
			<div class="form-actions">
				<button class="btn btn-primary js-ajax-submit" type="submit">{:L('ADD')}</button>
				<a class="btn" href="javascript:history.back(-1);">{:L('BACK')}</a>
			</div>
		</form>
	</div>
	<script type='text/javascript'>
		$(function() {
			$(".onkeymake").click(function(){
				var shopname = $("input[name='shopName']").val();
				var sp = $("input[name='sp']").val(pinyin.getCamelChars(shopname));
				var qp = $("input[name='qp']").val(pinyin.getFullChars(shopname));
				var jp = $("input[name='jp']").val(pinyin.getFirstCamelChars(shopname));
			});
			function CKupdate() {
				for (instance in CKEDITOR.instances)
					CKEDITOR.instances[instance].updateElement();
			}
			$(".js-ajax-submit").click(function() {
				CKupdate();
			});
		});
	</script>
	<script type="text/javascript" src="__PUBLIC__/js/common.js"></script>
	
	
</body>
</html>